Before You Start

Before developing your applications, learn the calling flows of camera and frame grabber, calling method, and error handling for better application.

API Calling Flow of Camera

You can initialize the camera, configure image acquisition related parameters and eventually acquire images through SDK.
Within the life cycle of SDK instance, the basic API calling flow of camera is shown below.

API Calling Flow of Camera.

API Calling Flow of Frame Grabber

You can initialize the frame grabber and configure parameters through SDK.
Within the life cycle of SDK instance, the bsaic API calling flow of frame grabber is shown below.

API Calling Flow of Frame Grabber.

Error Handling and Status Code

The SDK API will return an integer type code to indicate the calling status of the API. The status code is presented in hexadecimal format "0x\%x".
If the API is called normally and no errors are detected, "0x00000000" will be returned, otherwise, an error code will be returned.
Note
Go to file "MvErrorDefine_const.py" or Status Codes for the error code and its description.
You can refer to the following sample codes to check the API exception and return error.
# Turn on the device
ret = cam.MV_CC_OpenDevice(MV_ACCESS_Exclusive, 0)
if ret != 0:
print ("open device fail! ret[0x%x]" % ret)
sys.exit()
This instance shows the status of getting the calling of MV_CC_OpenDevice() when the camera is turned on.
  • If the camera can be turned on normally, this instance will not return error.
  • If the camera is connected to a third-party software when the API is called, MV_CC_OpenDevice() will fail to turn on the camera normally. In this case, the API will return following information.

    Open Device fail! nRet [0x80000203]

    After getting error information and status code, go to Status Codes or the file "MvErrorDefine_const.py" for details. In this instance, “0x80000203” represents “no access permission”.




Previous: Development Environment Configuration Next: SDK Initialization